<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Demo21</title>
    <script src="https://unpkg.com/vue@next" ></script>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    const app=Vue.createApp({ 
    data(){
        return{}
    },
    methods:{
        keydown(){
            console.log('pressed');
        },
        clicked(){
            alert('clicked')
        }
    },
    //.enter 属于 按键修饰符 意思是只有按下 enter 键才会触发
    //按键修饰符有很多
    //鼠标也有，left right middle 默认left
    template:`
        <div>
            <input @keydown.enter='keydown' />
            <div @click.right="clicked">jspang</div>
        </div>
        ` 
    }) 
    const vm=app.mount("#app")

</script>

</html>